//
//  ThreeMealTableViewCell.m
//  Food
//
//  Created by 15 on 15/7/15.
//  Copyright (c) 2015年 李志远. All rights reserved.
//

#import "ThreeMealTableViewCell.h"
#import "UIImageView+WebCache.h"
@implementation ThreeMealTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imgBg = [[[UIImageView alloc] init] autorelease];
        [self.contentView addSubview:self.imgBg];
        self.lblName = [[[UILabel alloc] init] autorelease];
        [self.imgBg addSubview:self.lblName];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.imgBg.frame = CGRectMake(10, 5, 300, 190);
    self.lblName.frame = CGRectMake(10, 160, 280, 20);
    self.lblName.shadowOffset = CGSizeMake(1, 1);
    self.lblName.textColor = [UIColor whiteColor];
}

- (void)setModel:(ThreeMealModel *)model
{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    self.lblName.text = model.name;
    [self.imgBg setImageWithURL:[NSURL URLWithString:_model.img] placeholderImage:[UIImage imageNamed:@"placeholder"]];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
